home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / include / my_bitmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-01-21  |  1.8 KB  |  57 lines  |  [TEXT/CWIE]

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
  2.    
  3.    This library is free software; you can redistribute it and/or
  4.    modify it under the terms of the GNU Library General Public
  5.    License as published by the Free Software Foundation; either
  6.    version 2 of the License, or (at your option) any later version.
  7.    
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.    
  13.    You should have received a copy of the GNU Library General Public
  14.    License along with this library; if not, write to the Free
  15.    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  16.    MA 02111-1307, USA */
  17.  
  18. #ifndef _my_bitmap_h_
  19. #define _my_bitmap_h_
  20.  
  21. #include <my_pthread.h>
  22.  
  23. #define MY_BIT_NONE (~(uint) 0)
  24.  
  25. typedef struct st_bitmap
  26. {
  27.   uchar *bitmap;
  28.   uint bitmap_size;
  29.   my_bool thread_safe; /* set if several threads access the bitmap */
  30.   /*
  31.      mutex will be acquired for the duration of each bitmap operation if
  32.      thread_safe flag is set. Otherwise, we optimize by not acquiring the
  33.      mutex
  34.    */
  35. #ifdef THREAD
  36.   pthread_mutex_t mutex;
  37. #endif
  38. } MY_BITMAP;
  39.  
  40. #ifdef    __cplusplus
  41. extern "C" {
  42. #endif
  43.   extern my_bool bitmap_init(MY_BITMAP *bitmap, uint bitmap_size,
  44.                  my_bool thread_safe);
  45.   extern void bitmap_free(MY_BITMAP *bitmap);
  46.   extern void bitmap_set_bit(MY_BITMAP *bitmap, uint bitmap_bit);
  47.   extern uint bitmap_set_next(MY_BITMAP *bitmap);
  48.   extern void bitmap_set_all(MY_BITMAP* bitmap);
  49.   extern my_bool bitmap_is_set(MY_BITMAP* bitmap, uint bitmap_bit);
  50.   extern void bitmap_clear_all(MY_BITMAP* bitmap);
  51.   extern void bitmap_clear_bit(MY_BITMAP *bitmap, uint bitmap_bit);
  52. #ifdef    __cplusplus
  53. }
  54. #endif
  55.  
  56. #endif /* _my_bitmap_h_ */
  57.